****
****
****	Addhealth_script.do
****
****
****	Replication file for anlyses of Add Health for:
****		
****	"Intersectionality, Depression, and Voter Turnout"
****
****	by Christopher Ojeda and Christine Slaughter
****
****
****	Table of Contents
****
****	- Section 1: Data prep
****
****	- Section 2: Analyses
****


********************************************************************************
****** Section 1: Data Prep

**
** Vote
gen pol_vote = H3CC8
replace pol_vote = . if H3CC8 == 6 | H3CC8 == 7 | H3CC8 == 8 | H3CC8 == 9

**
** Depression
forvalues i=5(1)13{
local a = `i' - 4
gen dep`a' = H3SP`i'
replace dep`a' = . if H3SP`i' == 6 | H3SP`i' == 8 | H3SP`i' == 9
}
*

recode dep3 dep7 (3=0) (2=1) (1=2) (0=3)
egen depression = rowmean(dep1 dep2 dep3 dep4 dep5 dep6 dep7 dep8 dep9)

**
** Gender
gen female = 1
replace female = 0 if BIO_SEX3 == 1 

**
** Race
gen white = H3OD4A
replace white = . if H3OD4A == 6 | H3OD4A == 8 | H3OD4A == 9
replace white = 0 if H3OD2 == 1

gen black = H3OD4B
replace black = . if H3OD4B == 6 | H3OD4B == 8 | H3OD4B == 9
replace black = 0 if H3OD2 == 1

keep if white == 1 | black == 1
drop if white == 1 & black == 1

**
** Age
gen age = 2002 - H3OD1Y

**
** Education
gen educ = H3ED1
replace educ = . if H3ED1 == 98 | H3ED1 == 99

**
** Income 
gen income = H3EC2
replace income = . if H3EC2 == 999996 | H3EC2 == 999998 | H3EC2 == 999999
gen inc_log = log(income + 0.01)

**
** Religious attendance
gen attend = H3RE24
replace attend = . if H3RE24 == 96 | H3RE24 == 98 |H3RE24 == 99

**
** Marital status
gen married = H3MR1
replace married = . if H3MR1 == 6 | H3MR1 == 8
recode married 3=1 2=1

**
** Party Strength
gen party_strength = H3CC15
replace party_strength = . if H3CC15 == 96 | H3CC15 == 98 | H3CC15 == 99
recode party_strength 97=0 1=1 2=1 3=1 4=1 5=1 6=1 7=1 8=1

**
** Health status
gen health_status = H3GH1
recode health_status 5=0 4=1 3=2 2=3 1=4

** 
** Health insurance
gen health_ins = H3HS5
replace health_ins = 0 if H3HS5 == 10 | H3HS5 == 96 | H3HS5 == 98 | H3HS5 == 99
recode health_ins 0=0 1=1 2=1 3=1 4=1 5=1 6=1 7=1 8=1 9=1

**
** Intersectional categories
gen inter_cat = .
replace inter_cat = 1 if white == 1 & female == 0
replace inter_cat = 2 if white == 1 & female == 1
replace inter_cat = 3 if black == 1 & female == 0
replace inter_cat = 4 if black == 1 & female == 1


********************************************************************************
** Section 2: Analyses

**
** Set weights
svyset [weight=GSWGT3_2]


**
** Methods, Data, and Measures

* Sample size & mean depression by group [Tables 1 & 2]
sum depression if inter_cat == 1
sum depression if inter_cat == 2
sum depression if inter_cat == 3
sum depression if inter_cat == 4

* Age of sample [Table 1]
sum age

* Mean differences in depression across group [Table 2]
pwmean depression, over(inter_cat) mcompare(tukey) effects

* Alpha scores for depression scales [Table 2]
alpha dep1 dep2 dep3 dep4 dep5 dep6 dep7 dep8 dep9, item std


**
** The Depression-Participation Gap

* Multivariate regression of vote on depression [coefficients for Figure 2, Table A.9]
forvalues i=1(1)5{
matrix add_gap`i' = J(1,2,.)
matrix coln add_gap`i' = estimate se
}
*

svy: logit pol_vote depression female black age educ inc_log attend married party_strength health_status health_ins
quietly: lincom depression
matrix add_gap1[1,1] = r(estimate)
matrix add_gap1[1,2] = r(se)

svy: logit pol_vote depression female black age educ inc_log attend married party_strength health_status health_ins if inter_cat == 1
quietly: lincom depression
matrix add_gap2[1,1] = r(estimate)
matrix add_gap2[1,2] = r(se)

svy: logit pol_vote depression female black age educ inc_log attend married party_strength health_status health_ins if inter_cat == 2
quietly: lincom depression
matrix add_gap3[1,1] = r(estimate)
matrix add_gap3[1,2] = r(se)

svy: logit pol_vote depression female black age educ inc_log attend married party_strength health_status health_ins if inter_cat == 3
quietly: lincom depression
matrix add_gap4[1,1] = r(estimate)
matrix add_gap4[1,2] = r(se)

svy: logit pol_vote depression female black age educ inc_log attend married party_strength health_status health_ins if inter_cat == 4
quietly: lincom depression
matrix add_gap5[1,1] = r(estimate)
matrix add_gap5[1,2] = r(se)

matrix rowname add_gap1 = "Overall" 
matrix rowname add_gap2 = "White Men" 
matrix rowname add_gap3 = "White Women" 
matrix rowname add_gap4 = "Black Men" 
matrix rowname add_gap5 = "Black Women"

* Interaction term [Note in text regarding Figure 2]
svy: logit pol_vote c.depression##inter_cat age educ inc_log attend married party_strength health_status health_ins

* Relative effect of depression [Table 3]
svy: logit pol_vote depression female black age educ inc_log attend married party_strength health_status health_ins
sum depression educ attend party_strength age inc_log
margins, at(depression = (.0389425 .9332497))
margins, at(educ = (11.253656 15.249144))
margins, at(attend = (.156157 4.073553))
margins, at(party_strength = (0 1))
margins, at(age = (21.153939 24.721701))
margins, at(inc_log = (4.480114 11.42659))


**
** Mitigating the Gap

* Income interaction models [Table 4, Table A.17]
svy: logit pol_vote c.depression##c.inc_log female black age educ inc_log attend married party_strength health_status health_ins
svy: logit pol_vote c.depression##c.inc_log age educ inc_log attend married party_strength health_status health_ins if inter_cat == 1
svy: logit pol_vote c.depression##c.inc_log age educ inc_log attend married party_strength health_status health_ins if inter_cat == 2
svy: logit pol_vote c.depression##c.inc_log age educ inc_log attend married party_strength health_status health_ins if inter_cat == 3
svy: logit pol_vote c.depression##c.inc_log age educ inc_log attend married party_strength health_status health_ins if inter_cat == 4

* Health insurance interaction models [Table 4, Table A.18]
svy: logit pol_vote c.depression##health_ins female black age educ inc_log attend married party_strength health_status health_ins
svy: logit pol_vote c.depression##health_ins age educ inc_log attend married party_strength health_status health_ins if inter_cat == 1
svy: logit pol_vote c.depression##health_ins age educ inc_log attend married party_strength health_status health_ins if inter_cat == 2
svy: logit pol_vote c.depression##health_ins age educ inc_log attend married party_strength health_status health_ins if inter_cat == 3
svy: logit pol_vote c.depression##health_ins age educ inc_log attend married party_strength health_status health_ins if inter_cat == 4

* Church attendance interaction models [Table 4, Table A.19]
svy: logit pol_vote c.depression##c.attend female black age educ inc_log attend married party_strength health_status health_ins
svy: logit pol_vote c.depression##c.attend age educ inc_log attend married party_strength health_status health_ins if inter_cat == 1
svy: logit pol_vote c.depression##c.attend age educ inc_log attend married party_strength health_status health_ins if inter_cat == 2
svy: logit pol_vote c.depression##c.attend age educ inc_log attend married party_strength health_status health_ins if inter_cat == 3
svy: logit pol_vote c.depression##c.attend age educ inc_log attend married party_strength health_status health_ins if inter_cat == 4


**
** Appendix

* Descriptive statistics, overall [Table A.3]
sum pol_vote depression female black age educ inc_log attend married party_strength health_status health_ins if depression != .

* Correlations between variables [Table A.6]
pwcorr pol_vote depression female black age educ inc_log attend married party_strength health_status health_ins if depression != .

* Effect of depression on each mitigator [Table A.20]
svy: reg income depression female black age educ attend married party_strength health_status health_ins
svy: logit health_ins depression female black age educ inc_log attend married party_strength health_status
svy: ologit attend depression female black age educ inc_log married party_strength health_status health_ins
